﻿
using System;
using System.Collections.Generic;
using System.Text;
using Chloe;
using Chloe.SqlServer;

namespace Mrc.DBContext
{
    public class DbContextHelper
    {
        public static IDbContext GetDBContext()
        {
            IDbContext dbContext;
            string connString = "Data Source =.;Initial Catalog =IISLogAnalisys;Persist Security Info=True;User ID=sa;Password=123";
            string dbType = "sqlserver";
            switch (dbType)
            {
                case "sqlserver":
                    dbContext = CreateSqlServerContext(connString);
                    break;
                default:
                    dbContext = CreateSqlServerContext(connString);
                    break;
            }
            return dbContext;
        }
        static IDbContext CreateSqlServerContext(string connString)
        {
            MsSqlContext dbContext = new MsSqlContext(connString);
            dbContext.PagingMode = PagingMode.OFFSET_FETCH;
            return dbContext;
        }
    }
}
